<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
	<meta charset="utf-8">
	<meta name="csrf-token" content="{{ csrf_token() }}">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>班级报表</title>
	<link rel="stylesheet" href="{{URL::asset('vendor/laravel-admin/AdminLTE/dist/css/AdminLTE.min.css')}}">
	<link href="{{URL::asset('vendor/laravel-admin/font-awesome/css/font-awesome.min.css')}}" rel="stylesheet">
	<link rel="stylesheet" href="{{URL::asset('vendor/laravel-admin/AdminLTE/bootstrap/css/bootstrap.min.css')}}">
	<link rel="stylesheet" href="{{URL::asset('vendor/layui/css/layui.css')}}">
	<link rel="stylesheet" href="{{URL::asset('vendor/bootstrap-table/bootstrap-table.min.css')}}">
	<script src="{{URL::asset('js/jquery.min.js')}}"></script>
	<script src="{{URL::asset('vendor/layui/layui.js')}}"></script>
	<script src="{{URL::asset('vendor/bootstrap-table/bootstrap.min.js')}}"></script>
	<script src="{{URL::asset('vendor/bootstrap-table/bootstrap-table.min.js')}}"></script>
	<script src="{{URL::asset('vendor/bootstrap-table/bootstrap-table.min.js')}}"></script>
	<script src="{{URL::asset('vendor/bootstrap-table/bootstrap-table-mobile.min.js')}}"></script>
	<script src="{{URL::asset('vendor/bootstrap-table/bootstrap-table-zh-CN.min.js')}}"></script>
	<script src="{{URL::asset('vendor/bootstrap-table/table-export-init.js')}}"></script>
	<script src="{{URL::asset('vendor/bootstrap-table/bootstrap-table-export.js')}}"></script>
	<style media="screen">
	body{
		padding: 30px;
		background-color: #f3f3f4;
	}
	.table-box{
		overflow-y: auto;
		position: relative;
	}
	#main {
		background-color: #FFF;padding:15px;
		border-radius: 4px;
		border: 1px solid #ebeef5;
		background-color: #fff;
		overflow: hidden;
		box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
		color: #303133;
		transition: .3s;
	}
	</style>
</head>
<body>
<div id="main">
	<div class="squad-info-box">
		<ul class="list-group">
			<li class="list-group-item">
				<strong>班级：</strong>{{$SquadInfo['name']}} <strong> ， </strong>
				<strong>班型：</strong>{{$SquadInfo['type_name']}} <strong> ， </strong>
				<strong>班段：</strong>{{$SquadInfo['section_name']}} <strong> ， </strong>
				<strong>分组：</strong>{{$SquadInfo['group_name']}}
			</li>
			<li class="list-group-item">
				<strong>批次：</strong>{{$SquadInfo['batch']}} <strong> ， </strong>
				<strong>校区：</strong>{{$SquadInfo['campus_name']}}
			</li>
		</ul>
	</div>
	<div class="form-box">
		<form id="ajaxForm">
			<input type="hidden" name="_token" value="{{csrf_token()}}">
			<input type="hidden" name="squad_id" value="{{$SquadInfo['id']}}">
			<input type="hidden" name="count_info" value="{{json_encode($Count)}}">
		</form>
		<form class="form-inline" id="seaForm" method="get">
			<input type="hidden" name="_token" value="{{csrf_token()}}">
			<div class="form-group">
				<label for="exampleInputName2">学年</label>
				<input type="text" class="form-control" value="{{$OPT['year']}}" style="width:100px;" name="year">
			</div>
			<div class="form-group">
				<label for="exampleInputName2">学季</label>
				<select class="form-control" name="season">
					@if($OPT['season'] == "1")
					<option value="1" selected>春季学期</option>
					<option value="2">秋季学期</option>
					@else
					<option value="1">春季学期</option>
					<option value="2" selected>秋季学期</option>
					@endif
				</select>
			</div>
			<div class="form-group">
				<label for="exampleInputName2">起始周</label>
				<select class="form-control" name="week_s">
					@foreach($OPT['start'] as $opt)
					@if($opt['value'] == $DefaultWeek['start'])
					<option value="{{$opt['value']}}" selected>{{$opt['label']}}</option>
					@else
					<option value="{{$opt['value']}}">{{$opt['label']}}</option>
					@endif
					@endforeach
				</select>
			</div>
			<div class="form-group">
				<label for="exampleInputEmail2">结束周</label>
				<select class="form-control" name="week_e">
					@foreach($OPT['end'] as $opt)
					@if($opt['value'] == $DefaultWeek['end'])
					<option value="{{$opt['value']}}" selected>{{$opt['label']}}</option>
					@else
					<option value="{{$opt['value']}}">{{$opt['label']}}</option>
					@endif
					@endforeach
				</select>
			</div>
			<button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> 查询</button>

			<a href="{{URL::asset('admin')}}" class="btn btn-danger">返回首页</a>
		</form>
	</div>
	<div class="table-box">
		<table id="curTable">
			<thead>
				<tr>
					<th data-align="center" data-field="no">学号</th>
					<th data-align="center" data-field="ch_name">中文名</th>
					<th data-align="center" data-field="en_name">英文名</th>
					@for($i=0; $i<$Count['tx']; $i++)
					<th data-align="center" data-field="tx_{{$i}}">听写-{{(int)$i + 1}}</th>
					@endfor
					@for($i=0; $i<$Count['cs']; $i++)
					<th data-align="center" data-field="cs_{{$i}}">测试-{{(int)$i + 1}}</th>
					@endfor
					@for($i=0; $i<$Count['kq']; $i++)
					<th data-align="center" data-field="kq_{{$i}}">考勤-{{(int)$i + 1}}</th>
					@endfor
					@for($i=0; $i<$Count['jx']; $i++)
					<th data-align="center" data-field="jx_{{$i}}">家校-{{(int)$i + 1}}</th>
					@endfor
					@for($i=0; $i<$Count['zy']; $i++)
					<th data-align="center" data-field="zy_{{$i}}">作业-{{(int)$i + 1}}</th>
					@endfor
				</tr>
			</thead>
		</table>
	</div>
</div>
</body>
<script type="text/javascript">
layui.use(['layer'], function(){
	var layer = layui.layer;
});
function initTable() {
	$('#curTable').bootstrapTable('destroy');
	$("#curTable").bootstrapTable({
		method: "get",
		url: "{{URL::asset('admin/my_squad_report/getdata')}}",
		striped: true,
		pagination: false,
		pageSize: 10,
		pageNumber: 1,
		pageList: [25,50,100],
		sidePagination: "server",
		queryParamsType: "undefined",
		showExport: true,
		exportTypes:['excel'],
		exportOptions:{
			fileName: '班级汇总_{{$SquadInfo["name"]}}',
			worksheetName: '班级汇总_{{$SquadInfo["name"]}}',
			tableName: '班级汇总_{{$SquadInfo["name"]}}',
			excelstyles: ['background-color', 'color', 'font-size', 'font-weight'],
			onMsoNumberFormat:function (cell, row, col) {
		       var result = "";
		       if (row > 0 && col == 0)
		           result = "\\@";
		       return result;
		   }
		},
		queryParams: function queryParams(params) { //设置查询参数
			return $("#ajaxForm").serialize();
		},
		onLoadSuccess: function(res) { //加载成功时执行
			layer.msg(res.msg);
		},
		onLoadError: function() { //加载失败时执行
			layer.msg('表格数据获取失败',{anim:6});
		}
	});
}
$(function(){
	initTable();
})
</script>
</html>
